c DISCUSSION : 
c Driver for ELO function
c
c Copyright 2004 Jeff Cliff
c
c This program is free software: you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation, either version 3 of the License, or (at
c your option) any later version.
c
c This program is distributed in the hope that it will be useful, but
c WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program.  If not, see https://www.gnu.org/licenses/
c
c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

      program main
      REAL player1rating
      REAL player2rating
      REAL x

      write (*,*) 'input the first player''s rating'
      read (*,*) player1rating
      write (*,*) 'input the second player''s rating'
      read (*,*) player2rating

      x = elo(player1rating,player2rating)
      write (*,*) 'player1''s odds of winning is ', x, '%'

      x = elo(player2rating,player1rating)
      write (*,*) 'player2''s odds of winning is ', x, '%'

      end 

c ccccccccccccccccccccccccccccccccccccccccccccccccc
c ccccccccccccccccccccccccccccccccccccccccccccccccc
c ELO program
c Given two ELO ratings (usually somewhere around 1400)
c the chance of winning for the player with rating r
c is calculated
c
c ccccccccccccccccccccccccccccccccccccccccccccccccc
c ccccccccccccccccccccccccccccccccccccccccccccccccc
      REAL function elo(r,s) 
      REAL r,s,t,u,v

      elo = s - r
      elo = elo / 400.0D0
      t = 100.0D0
      u = 1.0D0
      v = 10.0D0
      elo = t * ( u / ( u + v ** elo ) )

      return
      end
c ccccccccccccccccccccccccccccccccccccccccccccccccc
c ccccccccccccccccccccccccccccccccccccccccccccccccc
